      REAL FUNCTION SOZEFF(ATOM)
C
C     ******************************************************************
C
      IMPLICIT NONE
C
      INCLUDE 'fileio.h'
C
      INTEGER, PARAMETER :: MAXAN = 80
C
      INTEGER ATOM
      INTEGER, DIMENSION(MAXAN) :: NEVAL
C
C     O~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~O
C
      DATA NEVAL/1,2, 
     $           1,2,3,4,5,6,7,8,
     $           1,2,3,4,5,6,7,8, 
     $           1,2,3,4,5,6,7,8,9,10,11,12,
     $                   3,4,5,6,7,8,
     $           1,2,3,4,5,6,7,8,9,10,11,12,
     $                   3,4,5,6,7,8/
C
C     O~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~O
C
      NEVAL(57)=3 !The number of nd + (n+1)s electrons
      NEVAL(72:80)=(/ 4,5,6,7,8,9,10,11,12 /) !The number of nd + (n+1)s electrons
C     Original Molsoc parameters for main group first five rows,
C     suitable for all-electrons basis set, see JCC, 30, 832 (2009)
      IF (ATOM == 1) THEN
        SOZEFF = 1.0
      ELSE IF (ATOM == 2) THEN
        SOZEFF = 2.0
      ELSE IF ((ATOM > 2).AND.(ATOM <= 10)) THEN
        SOZEFF = (0.2517 + 0.0626*NEVAL(ATOM))*ATOM
      ELSE IF ((ATOM > 10).AND.(ATOM <= 18)) THEN
        SOZEFF = (0.7213 + 0.0144*NEVAL(ATOM))*ATOM
      ELSE IF (((ATOM > 18).AND.(ATOM <= 20)).OR.((ATOM > 30).
     $                      AND.(ATOM <= 36))) THEN
        SOZEFF = (0.8791 + 0.0039*NEVAL(ATOM))*ATOM
      ELSE IF (((ATOM > 36).AND.(ATOM <= 38)).OR.((ATOM > 48).
     $                      AND.(ATOM <= 54))) THEN
        SOZEFF = (0.9228 + 0.0017*NEVAL(ATOM))*ATOM
C     Below are d and ds parameters for small core ECP, Koseki, JPCA, 102, 10430
C     For 3d metals
      ELSE IF (ATOM>=21.and.ATOM<=29) THEN
        SOZEFF = (0.385D0 + 0.025D0*(NEVAL(ATOM)-2))*ATOM
C     For 4d metals
      ELSE IF (ATOM>=39.and.ATOM<=47) THEN
        SOZEFF = (4.680D0 + 0.060D0*(NEVAL(ATOM)-2))*ATOM
C     For 5d metals
      ELSE IF (ATOM==57.or.(ATOM>=72.and.ATOM<=79)) THEN
        SOZEFF = (13.960D0 + 0.140D0*(NEVAL(ATOM)-2))*ATOM
C     For all ds metals
      ELSE IF (ATOM==30) THEN !Zn
        SOZEFF = 11D0*ATOM
      ELSE IF (ATOM==48) THEN !Cd
        SOZEFF = 33D0*ATOM
      ELSE IF (ATOM==80) THEN !Hg
        SOZEFF = 113D0*ATOM
      ELSE
        WRITE(OUT,1000) ATOM
        STOP
      END IF
      WRITE(*,"(' SOZEFF for atom',i5,' :',f12.6)") ATOM,SOZEFF
C
C     O~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~O
C
C     ___ Format statements ___
C
 1000 FORMAT(/,T2,'SOZEFF: SOZEFF IS NOT AVAILABLE FOR ATOMIC NUMBER',
     $         I5)
C
C     O________________________________________________________________O
C
      END FUNCTION SOZEFF
